package com.hmall.api.client;

import com.hmall.api.dto.ItemDTO;
import com.hmall.api.dto.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * ClassName: ItemClient
 * Package: com.hmall.cart.client
 * Description:
 *
 * @Author zhangdingye
 * @Create 2025/4/25 下午12:28
 * @Version 1.0
 */
@FeignClient("item-service")
public interface ItemClient {

    // 抽取根据id集合查询商品信息接口
    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

    // 抽取扣减库存接口
    @PutMapping("/items/stock/deduct")
    void deductStock(List<OrderDetailDTO> items);
}
